<template>
  <uv-upload
    maxCount="1"
    :previewFullImage="false"
    :custom-style="uploadStyle"
    @beforeRead="beforeRead"
    @afterRead="handleAfterRead"
  />
</template>

<script lang="ts" setup>
const emits = defineEmits(["update-url"]);

const handleAfterRead = (event: any) => {
  console.log(event);
  emits("update-url", event.file);
};
const beforeRead = (file: File) => {
  console.log(file);
};

const uploadStyle = {
  position: "absolute",
  top: "50%",
  left: "50%",
  opacity: "0",
  transform: "translate(-50%, -50%)"
};
</script>
